#!/usr/bin/env ruby
=begin
    This file is part of GSRuby.

    GSRuby is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GSRuby is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GSRuby.  If not, see <http://www.gnu.org/licenses/>.
=end

=begin
    Displays your home timeline.

    USAGE:
    - Edit the variables node, user and password
    - Remove 'ssl: true' if your instance doesn't use SSL
    - Add 'ssl_insecure: true' if your instance uses a 
      self-signed cert
    - Give execute permission to this script, run in your shell:
        $ chmod +x home_timeline.rb
    - Execute the script with your status, run:
        $ ./home_timeline.rb
=end
require 'gsruby'

node = 'https://yourinstance.tld'
user = 'your_username'
passwd = 'your_password'

session = GNUSocial::Client.new(node,user,passwd, ssl: true)

puts "Home timeline"
session.home_timeline.notices do |notice|
    print notice.author
    print ' > ' + notice.reply_to_name if notice.is_reply?
    puts " (#{notice.created_at}) [ID: #{notice.id}]"
    puts notice.text
    puts ''
end
